package com.framework.modules.base.dao;

import com.framework.modules.base.entity.UserInfoEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 用户信息表
 * 
 * @author MIT
 * @email litmiss@gmail.com
 * @date 2020-10-21 01:30:14
 */
public interface UserInfoDao extends BaseMapper<UserInfoEntity> {
    @Select("select * from tb_user_info where nickname=#{nickname}")
    UserInfoEntity queryByNickname(@Param("nickname") String nickname);

    /**
     * 查看用户主页信息
     * @param uid
     * @return
     */
    @Select("select nickname,gender,level,ibo,avanta,birthday,constel,area,school,tags,sense from tb_user_info where uid=#{uid}")
    UserInfoEntity getOtherUserInfo(@Param("uid")Long uid);

    /**
     * 获取推荐好友
     * @return
     */
    @Select("select uid,nickname,gender,level,avanta from tb_user_info where uid!=#{uid} order by uid desc limit #{limit}")
    List<UserInfoEntity> getRecommandUserList(@Param("limit")Integer limit,@Param("uid") Long uid);

}
